package com.xh.lesson.controller;

import com.xh.lesson.service.UpLoadService;
import com.xh.lesson.utils.DataResult;
import com.xh.lesson.vo.req.HomeAddReqVO;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("/sys")
public class UploadController {
    @Autowired
    private UpLoadService upLoadService;
    @PostMapping("/upload")
    public DataResult<HomeAddReqVO> uploadFile(@RequestParam("file") MultipartFile file) throws IOException {
        DataResult result = DataResult.success();
        result.setData(upLoadService.uploadFile(file));
        System.out.println("收到了");
        return result;
    }
}
